/************************************************************************
 *				SRLOS Team CopyRight
 *@file		lib.c
 *@author	bloceanc
 *@date		7/23/2010
 *@note		common routines
 ************************************************************************/

// counter x/y
unsigned long uldiv(unsigned long x, unsigned long y)
{
	unsigned long i = 0;
	unsigned long res = 0;

	while(1)
	{
		while((y<<i)<=x)
		{
			i++;
		}

		if(i<2)
			return res+1;
		i--;
		res+=1<<i;
		x -= y<<i; //(1<<i) * y;		
		i = 0;
	}
}